﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
using Microsoft.AspNetCore.Razor.TagHelpers;

namespace WebApplication1.TagHelpers
{
    // You may need to install the Microsoft.AspNetCore.Razor.Runtime package into your project
    //Attributes:应用到属性
    //[HtmlTargetElement("bold",Attributes ="bold")] //这里是并且关系,必须是bold标签,标签上带有bold属性

    //以下两个特性是或者的关系,bold标签,或者标签带bold属性
    [HtmlTargetElement(Attributes ="bold")]
    [HtmlTargetElement("bold")]
    public class BoldTagHelper : TagHelper
    {
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            output.Attributes.RemoveAll("bold");
            output.PreContent.SetHtmlContent("<strong>");
            output.PostContent.SetHtmlContent("</strong>");

        }
    }
}
